use derive_builder::Builder;
use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use crate::{
    error::Error,
    modeling::{
        Class, ComparsionOperator, LogicalOperator, PagingResponse, RelationDirection,
        RelationRelatedType, RelationType, RelationTypeOperator, Value, ValueOperator,
    },
};

use crate::database::DataSource;

#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct QuerySelect {
    pub attribute_includes: Option<Vec<String>>,
    pub attribute_excludes: Option<Vec<String>>,
    pub relation_includes: Option<Vec<String>>,
    pub relation_excludes: Option<Vec<String>>,
}

impl QuerySelect {
    pub fn with_include(name: String) -> anyhow::Result<QuerySelect> {
        let res = Self {
            attribute_includes: Some(vec![name]),
            attribute_excludes: None,
            relation_excludes: None,
            relation_includes: None,
        };
        Ok(res)
    }
    pub fn with_includes(names: Vec<String>) -> anyhow::Result<QuerySelect> {
        let res = Self {
            attribute_includes: Some(names),
            attribute_excludes: None,
            relation_excludes: None,
            relation_includes: None,
        };
        Ok(res)
    }
}
